package com.woniuxy;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;

public class ParseJWTDem {
    public static void main(String[] args) {
        String token ="eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJ3b25pdXh5Iiwic3ViIjoi566h55CG5ZGYIiwiaWF0IjoxNjYyMzUxNDE4LCJleHAiOjE2NjIzNTE0NDgsImFjY291bnQiOiJhZG1pbiIsInN0YXR1cyI6IlkifQ.5DqJZKgZRTAl7eokyDLKqd_0B-CCJIbGwcutw0fKSlk";
        //我们需要解析身体中的存入的信息
        Claims claims = Jwts.parser().setSigningKey("zhangsan").parseClaimsJws(token).getBody();
        System.out.println(claims.getId());
        System.out.println(claims.getIssuedAt());
        System.out.println(claims.getSubject());
        System.out.println(claims.get("account"));
        System.out.println(claims.get("status"));
        System.out.println(claims.getExpiration());
    }
}
